﻿using com.youzu.warh.protocol;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcChangeWeapon : AIBaseNode
    {
        public BBParameter<int> weaponId;
        public BBParameter<bool> selectDefaultWeapon = false;
        
        protected override void OnExecute()
        {
            int selectedWeaponId = weaponId.value;
            if (selectDefaultWeapon.value)
            {
                PbAIPropertyDataConfig aiPropertyDataConfig = _entity.propertyDataConfig;
                selectedWeaponId = aiPropertyDataConfig.weapon_id;
            }
            
            _entity.battleAgent.ChangeWeapon(selectedWeaponId);
            // _entity.WeaponSystem.ChangeWeapon(selectedWeaponId);
            // BattleState battleState = BattleState.None;
            // // 切换状态
            // PbWeaponDataConfig weaponDataConfig = LibertyConfigManager.GetInstance().GetWeaponDataConfig(_entity.WeaponSystem.SelectedWeaponId);
            // if (weaponDataConfig != null)
            // {
            //     battleState = (BattleState)weaponDataConfig.battle_state;
            // }
            // _entity.viewer.animationAgent.EnterBattleState(battleState);
            // _entity.viewer.animationAgent.EnterAimingState(AimingState.None);
            EndAction(true);
        }
    }
}